<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>我的电商系统</title>
	<base href="http://localhost/shop/" />
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>public/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>public/css/bootstrap-theme.min.css">
	 <link rel="stylesheet" href="<?=base_url()?>public/nivo/nivo-slider.css" type="text/css" media="screen" />
	 <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>public/css/front.css">
</head>
	<div class="container">
<!--head-->	
	<?php $this->load->view('header') ?>
<!--banner-->
	<div class="row">
		<div class="col-md-6">
			<div id="prodect_img">
				<img src="<?php echo base_url($prodect->img) ?>" id="main_img">
				<ul>
					<?php foreach ($prodect_img as $pi) {
					?>
						<li><img src="<?php echo base_url($pi->url) ?>" class="img" ></li>
					<?php	
					} ?>
					
				</ul>
			</div>
		</div>
		<div class="col-md-6">
			<div id="right">
				<h4><?php echo $prodect->title ?></h4>
				<table id="prodect_arg">
					<tr>
						<td class="la">价格:</td>
						<td class="price">￥<?php echo number_format($prodect->price,2)?></td>
					</tr>
					<tr>
						<td class="la">商品评分:</td>
						<td class="star"><?php for ($i=0; $i < 5; $i++) { 
						?>
							<?php if($i<$prodect->star){?><i class="glyphicon glyphicon-star"></i> <?php } else{
								?><i class="glyphicon glyphicon-star-empty"></i>
								<?php
							}
						} ?>
						</td>
					</tr>
					<tr>
						<td class="la">运费:</td>
						<td class="deliver_fee">满99免运费</td>
					</tr>
					<tr>
						<form action="<?php echo site_url('shoping/add') ?>" method="post">
						<input type="hidden" name="prodect_id" value="<?php echo $prodect->id ?>">
						<td class="la">购买数量:</td>
						<td class="num"><span id="minus">-</span><input type="text" name="num" value="1" id="n"><span id="add">+</span></td>
					</tr>
					<tr>
						<td class="la">运货:</td>
						<td class="deliver">由仓库全国最近点 发货，并提供售后服务。如有问题咨询在线客服~!
                         上午08:30前完成下单下午送达,下午下单隔日第二天送达.</td>
					</tr>	
				</table>
				<a href="<?php echo site_url('shoping/shopcart/') ?>" class="btn btn-danger btn-lg buy">立即购买</a><button type="submit" class="btn btn-info btn-lg car">加入购物车</button>		
		 	</div>
		 </form>
		</div>	
	</div>
	<div class="row">
		<div class="col-md-3"></div>
		<div class="col-md-9">
		<h4>商品详情</h4>
			<?php echo htmlspecialchars_decode($prodect->content) ?>
		</div>
	</div>
</div>
<script type="text/javascript" src="<?php echo base_url();?>public/js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/jquery.elevateZoom-3.0.8.min.js"></script>

	<script type="text/javascript">
	    $(window).load(function() {
	    	$('#prodect_img ul li').mouseover(function(){
	    		$('#prodect_img ul li').removeClass('hover');
	    		$(this).addClass('hover');
	    		var src=$(this).find('img').attr('src');
	    		$('#prodect_img #main_img').attr('src',src);
	    		$('.zoomWindowContainer div').css('background-image','url("'+src+'")');
	    	});
	    	$( '.num #add').click(function(){
	    		var n=$('.num #n').val();
	    		n=parseInt(n)+1;
	    		$('.num #n').val(n);
	    	});
	    	$('.num #minus').click(function(){
	    		var n=$('.num #n').val();
	    		 n=parseInt(n)-1;
	    		if(n>0){
	    			$('.num #n').val(n);
	    		};
	    	})
	    	$(' #prodect_img #main_img').elevateZoom({
	    		//zoomType:"inner",
	    		zoomWindowWidth:200,
	    		zoomWindowHeight:200,

	    	});  
	    });
	</script>
</html>